<?php echo $this->element('right_panel'); ?>
<h2>Add new song</h2>
<p>Please submit links only to really good music:) Name of the song and interpret in the title is also very important!</p>
<div class="songs form">
<?php echo $this->Form->create('Song');?>
	<fieldset>
<?php
echo $this->Form->input('title');
echo $this->Form->input('url');
echo '<label for="SongCategoryId">Category</label>';
echo '<select name="data[Song][category_id]" id="SongCategoryId">';
foreach ($groups as $id => $group){
	echo '<optgroup label="'.$group['Group']['title'].'">';
	foreach ($categories as $i => $category){
		if ($category['Category']['group_id'] == $group['Group']['id']){
			echo '<option value="'.$category['Category']['id'].'">'.$category['Category']['title'].'</option>';
		}
	}	
		echo "</optgroup>";
}
echo '</select>';
?>
	</fieldset>
<?php echo $this->Form->end(__('Submit', true));?>
</div>
